#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define flr(x,l,r) for (int x = l; x <= r; ++ x)
#define frl(x,r,l) for (int x = r; x >= l; -- x)
#define fmp(x,t) for (int x = h[t]; ~x; x = ne[x])
#define LL long long 
#define mt memset 
#define szf sizeof
#define INF 0x3f3f3f3f
#define in(x) scanf("%d", &x)
#define out(x) printf("%d", x)
#define inll(x) scanf("%lld", &x)
#define outll(x) printf("%lld", x)
#define pn printf("\n")
#define con continue
#define bk break
#define vc vector
#define pb push_back
#define sz size
#define PII pair<int, int>
#define x first
#define y second
#define P_q priority_queue

using namespace std;

const int N = 1010, M = 21010;

int n, m, T;
int h[N], e[M], w[M], ne[M], idx;
int dist[N];
int q[N];
bool st[N];

void add(int a, int b, int c) {
    e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx ++ ;
}

int spfa() {
    mt(dist, 0x3f, szf dist);
    dist[0] = 0;
    q[0] = 0;
    int hh = 0, tt = 1;
    
    while (hh != tt) {
        int t = q[hh ++ ];
        if (hh == N) hh = 0;
        st[t] = false;
        
        fmp (i, t) {
            int j = e[i];
            if (dist[j] > dist[t] + w[i]) {
                dist[j] = dist[t] + w[i];
                if (!st[j]) {
                    q[tt ++ ] = j;
                    if (tt == N) tt = 0;
                    st[j] = true;
                }
            }
        }
    }
    
    if (dist[T] == INF) return -1;
    return dist[T];
}

int main() {
	while (scanf("%d%d%d", &n, &m, &T) != -1) {
	    mt(h, -1, szf h);
	    idx = 0;
	    while (m -- ) {
	        int a, b, c;
	        in(a), in(b), in(c);
	        add(a, b, c);
	    }
	    
	    int w;
	    in(w);
	    while (w -- ) {
	        int ver;
	        in(ver);
	        add(0, ver, 0);
	    }
	    
	    out(spfa()), pn;
	}
	
	return 0;
}